﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _46 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "FileIds",
                table: "ParentChildTasksRecord",
                type: "longtext",
                nullable: true,
                comment: "文件id集合")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<decimal>(
                name: "Heat",
                table: "FoodMaterials",
                type: "decimal(65,30)",
                nullable: false,
                comment: "热量",
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "热量");

            migrationBuilder.AlterColumn<decimal>(
                name: "FoodDepartment",
                table: "FoodMaterials",
                type: "decimal(65,30)",
                nullable: false,
                comment: "食部",
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "食部");

            migrationBuilder.CreateTable(
                name: "ParentChildTasksRecordImage",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    FiledId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "文件Id", collation: "ascii_general_ci"),
                    FileName = table.Column<string>(type: "longtext", nullable: false, comment: "文件名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FileSize = table.Column<string>(type: "longtext", nullable: false, comment: "文件大小")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ParentChildTasksRecordId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "班级动态Id", collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "软删标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    CreatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建用户Id", collation: "ascii_general_ci"),
                    UpdatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "更新时间"),
                    UpdatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "更新用户Id", collation: "ascii_general_ci"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "机构Id", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ParentChildTasksRecordImage", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ParentChildTasksRecordImage_ParentChildTasksRecord_ParentChi~",
                        column: x => x.ParentChildTasksRecordId,
                        principalTable: "ParentChildTasksRecord",
                        principalColumn: "Id");
                },
                comment: "亲子任务图片表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_ParentChildTasksRecordImage_ParentChildTasksRecordId",
                table: "ParentChildTasksRecordImage",
                column: "ParentChildTasksRecordId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ParentChildTasksRecordImage");

            migrationBuilder.DropColumn(
                name: "FileIds",
                table: "ParentChildTasksRecord");

            migrationBuilder.AlterColumn<int>(
                name: "Heat",
                table: "FoodMaterials",
                type: "int",
                nullable: false,
                comment: "热量",
                oldClrType: typeof(decimal),
                oldType: "decimal(65,30)",
                oldComment: "热量");

            migrationBuilder.AlterColumn<int>(
                name: "FoodDepartment",
                table: "FoodMaterials",
                type: "int",
                nullable: false,
                comment: "食部",
                oldClrType: typeof(decimal),
                oldType: "decimal(65,30)",
                oldComment: "食部");
        }
    }
}
